From ab8445a7e10df5bf243038219a389b7c85f0c239 Mon Sep 17 00:00:00 2001 From: tsteven4 Date: Thu, 22 Aug 2013 12:45:45 +0000 Subject: [PATCH] fix another link related memory issue with the gpx reader. --- gpsbabel/gpx.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/gpsbabel/gpx.cc b/gpsbabel/gpx.cc index e7b2a998b..2421c0824 100644 --- a/gpsbabel/gpx.cc +++ b/gpsbabel/gpx.cc @@ -57,8 +57,8 @@ static const char* input_fname; static gpsbabel::File* oqfile; static gpsbabel::XmlStreamWriter* writer; static short_handle mkshort_handle; -static const char* link_url; -static char* link_text = NULL; +static const char* link_url = NULL; +static const char* link_text = NULL; static const char* input_string = NULL; static int input_string_len = 0; @@ -687,7 +687,7 @@ gpx_start(void* data, const XML_Char* xml_el, const XML_Char** xml_attr) break; case tt_wpt_link: if (attr[0] && attr[1] && 0 == strcmp(attr[0], "href")) { - link_url = attr[1]; + link_url = xstrdup(attr[1]); } break; case tt_rte: @@ -1205,6 +1205,10 @@ gpx_end(void* data, const XML_Char* xml_el) xfree(link_text); link_text = NULL; } + if (link_url) { + xfree(link_url); + link_url = NULL; + } break; case tt_wpt_link_text: if (cdatastrp[0]) { -- 2.30.2